﻿using UnityEngine;
using System.Collections;

public class ThrowedObj : MonoBehaviour {
	public Transform target;
	public float speed = 1.0f;
	public float up = 2.0f;

	// Use this for initialization
	void Start () {


	}
	
	// Update is called once per frame
	void Update () {
		if(target != null && !rigidbody.useGravity){
			Vector3 dir = (target.transform.position - transform.position) * speed;
			dir.y = up;
			rigidbody.velocity = dir;
			rigidbody.useGravity = true;
		}
	}
}
